home *** CD-ROM | disk | FTP | other *** search
- ' **** ARCBIT multiple archive bit adjuster (LDW BASIC 2.0 source code)
- '
- DEF PROC FILECOUNT(PATH$)
- D#=PEEK_L(VARPTR(PATH$))
- GEMDOS 78,D#,0
- check_gemdos#=STATUS
- NFILES@=0
- WHILE check_gemdos#>=0
- GEMDOS 79
- check_gemdos#=STATUS
- NFILES@=NFILES@+1
- WEND
- ENDPROC NFILES@
-
- OPENW 0,0,0,640,200,1
- TITLEW 0," ARCHIVE BIT ADJUSTER "
- gotoxy 39,0:print "by"
- gotoxy 34,2:print "Allan Zachary"
- RESET
- path$="\*.*"
- start:
- selected_file$=""
- f$=""
- if nfiles@ then erase file_list$
- alert 0," Choose a path... ",1," OK | DONE ",answer@
- if answer@=2 then end
- ask file path$,selected_file$,f$,found@
- if found@<>1 then end
- i@=len(path$)
- while mid$(path$,i@,1)<>"\" and i@>0
- i@=i@-1
- wend
-
- if i@>0 then
- folder$=left$(path$,i@)
- else
- alert 3," Pathname error? ",1," REDO | QUIT ",answer@
- if answer@=2 then end
- goto start
- endif
-
- nfiles@=proc filecount(path$)
- if nfiles@=0 then
- alert 3," No files found! ",1," OK ",answer@
- gosub top_bar
- goto start
- endif
- dim file_list$(nfiles@)
- message$= str$(nfiles@)+" files,- getting filenames... "
- titlew 0,message$
-
- 'set up directory search
- d#=peek_l(varptr(path$))
- gemdos 78,d#,0
-
- for i@=1 to nfiles@
-
- gemdos 47 'find disk transfer address
- dta_adr#=status
-
- filename$=""
- a=1
- for j@=0 to 13
- if a=0 then goto finished
- a=peek_b(dta_adr#+30+j@)
- filename$=filename$+chr$(a)
- finished:
- next j@
- file_list$(i@)=folder$+filename$
- gemdos 79
- next i@
-
- gosub top_bar
- alert 2," Set archive bit ",2," ON | OFF | QUIT ",mode@
-
- if mode@=1 then
- message$=" Turning archive bits on... "
- titlew 0,message$
- for i@=1 to nfiles@
- gotoxy 1,1:print using "### of ###",i@,nfiles@
- d#=peek_l(varptr(file_list$(i@)))
- gemdos 67,d#,1,32 'put file archived attribute
- check_gemdos#=status
- if check_gemdos#<0 then gosub gd_error
- next i@
- elseif mode@=2 then
- message$=" Turning archive bits off... "
- titlew 0,message$
- for i@=1 to nfiles@
- gotoxy 1,1:print using "### of ###",i@,nfiles@
- d#=peek_l(varptr(file_list$(i@)))
- gemdos 67,d#,1,0 'put file NOT archived attribute
- check_gemdos#=status
- if check_gemdos#<0 then gosub gd_error
- next i@
- elseif mode@=3 then
- end
- endif
- gosub top_bar
- goto start
-
- gd_error:
- gd_error$=""
- if check_gemdos#=-32 then gd_error$="| (Invalid function number) "
- if check_gemdos#=-33 then gd_error$="| (file not found) "
- if check_gemdos#=-34 then gd_error$="| (path not found) "
- if check_gemdos#=-35 then gd_error$="| (too many files open) "
- if check_gemdos#=-36 then gd_error$="| (access denied) "
- if check_gemdos#=-39 or check_gemdos#=-41 or check_gemdos#=-42 then gd_error$="| (insufficient memory) "
- if check_gemdos#=-46 then gd_error$="| (Invalid drive specified) "
- if check_gemdos#=-47 then gd_error$="| (Invalid operation) "
- if check_gemdos#=-49 then gd_error$="| (no more files) "
- message$=" GEMDOS error #"+str$(check_gemdos#)+"! "+gd_error$
- alert 0,message$,1," ok | quit ",answer@
- if answer@=2 then end
- return
-
- top_bar:
- OPENW 0
- TITLEW 0," ARCHIVE BIT ADJUSTER "
- return
-